package xyz.syyrjx.registry.load;

import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import xyz.syyrjx.registry.SyyrjxRpcRegistryClass;

/**
 * @author 大地崩坏苍蝇兽
 * @date 2023/1/16 - 18:30
 */
public class SyyrjxRpcRegistryClientLoadAware implements ApplicationContextAware {

    private final static Logger LOGGER = LoggerFactory.getLogger(SyyrjxRpcRegistryClientLoadAware.class);

    @SneakyThrows
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        SyyrjxRpcRegistryEnvironmentSetAware.environmentInit(applicationContext);
        SyyrjxRpcRegistryClass load = applicationContext.getBean(SyyrjxRpcRegistryClass.class);
        load.clientStart();
    }
}
